package com.foreknow.demo;

import java.util.Scanner;

/**
 * 方法：就是一个功能
 *      访问权限 返回值类型 方法名(参数1......参数n){
 *          return 返回值
 *      }
 */
public class Test {
    public static void main(String[] args) {
        //方法的调用
        //Test.login();
       /*int sum = Test.method2(3,2);
        System.out.println(sum);
        boolean isRigth=Test.isLogin("tom","1234");*/

       /* if (isRigth){
            System.out.println("success......");
        }
        else{
            System.out.println("error......");
        }*/

        /*int[] arr = Test.method3();
        for(int i = 0;i<arr.length;i++){
            System.out.println(arr[i]);*/

        int[] array ={1,2,3,45,56,16};
        int[] arr1 = Test.method4(array);
        for (int i = 0;i< arr1.length;i++){
            System.out.println(arr1[i]);
        }
    }
    public static void login(){
        System.out.println("请输入用户名：");
        Scanner scan=new Scanner(System.in);
        String name = scan.next();
        System.out.println("请输入密码");
        String password = scan.next();
        System.out.println("登录成功！");
    }
    /**
     * 累加求和
     * @param a
     * @param b
     * @return
     */
    public static int method2(int a,int b){
        return a+b;
    }

    public static boolean isLogin(String username,String password){
        System.out.println(username+"------"+password);
        return false;
    }

    public static int[] method3(){
        int[] array ={1,2,3,45,56,16};
        return array;
    }
    public static int[] method4(int[] array){
        return array;
    }
}
